package com.ruoyi.hualian.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.hualian.domain.HlShapeAxle;
import com.ruoyi.hualian.service.IHlShapeAxleService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 形状-轴孔Controller
 * 
 * @author hujian
 */
@RestController
@RequestMapping("/hualian/axle")
public class HlShapeAxleController extends BaseController
{
    @Autowired
    private IHlShapeAxleService hlShapeAxleService;

    /**
     * 查询形状-轴孔列表
     */
    @GetMapping("/list")
    public TableDataInfo list(HlShapeAxle hlShapeAxle)
    {
        startPage();
        List<HlShapeAxle> list = hlShapeAxleService.selectHlShapeAxleList(hlShapeAxle);
        return getDataTable(list);
    }

    /**
     * 导出形状-轴孔列表
     */
    @Log(title = "形状-轴孔", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HlShapeAxle hlShapeAxle)
    {
        List<HlShapeAxle> list = hlShapeAxleService.selectHlShapeAxleList(hlShapeAxle);
        ExcelUtil<HlShapeAxle> util = new ExcelUtil<HlShapeAxle>(HlShapeAxle.class);
        util.exportExcel(response, list, "形状-轴孔数据");
    }

    /**
     * 获取形状-轴孔详细信息
     */
    @GetMapping(value = "/{sphapeAxleId}")
    public AjaxResult getInfo(@PathVariable("sphapeAxleId") Long sphapeAxleId)
    {
        return success(hlShapeAxleService.selectHlShapeAxleBySphapeAxleId(sphapeAxleId));
    }

    /**
     * 新增形状-轴孔
     */
    @Log(title = "形状-轴孔", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HlShapeAxle hlShapeAxle)
    {
        return toAjax(hlShapeAxleService.insertHlShapeAxle(hlShapeAxle));
    }

    /**
     * 修改形状-轴孔
     */
    @Log(title = "形状-轴孔", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HlShapeAxle hlShapeAxle)
    {
        return toAjax(hlShapeAxleService.updateHlShapeAxle(hlShapeAxle));
    }

    /**
     * 删除形状-轴孔
     */
    @Log(title = "形状-轴孔", businessType = BusinessType.DELETE)
	@DeleteMapping("/{sphapeAxleIds}")
    public AjaxResult remove(@PathVariable Long[] sphapeAxleIds)
    {
        return toAjax(hlShapeAxleService.deleteHlShapeAxleBySphapeAxleIds(sphapeAxleIds));
    }
}
